/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.vfi.be;

import edu.upn.sigemfi.ope.be.Ventanilla;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "VFI_CAJA")
@NamedQueries({@NamedQuery(name = "Caja.findAll", query = "SELECT c FROM Caja c"), @NamedQuery(name = "Caja.findByIdCaja", query = "SELECT c FROM Caja c WHERE c.idCaja = :idCaja"), @NamedQuery(name = "Caja.findByNombre", query = "SELECT c FROM Caja c WHERE c.nombre = :nombre"), @NamedQuery(name = "Caja.findByFidOpeVentanilla", query = "SELECT c FROM Caja c WHERE c.fidOpeVentanilla = :fidOpeVentanilla")})
public class Caja implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CAJA", nullable = false)
    private Long idCaja;
    @Column(name = "NOMBRE", length = 50)
    private String nombre;
  
    @OneToMany(mappedBy = "fidVfiCaja")
    private List<SaldoCaja> saldoCajaList;
    @OneToMany(mappedBy = "fidVfiCaja")
    private List<DetalleCaja> detalleCajaList;

     @OneToMany(mappedBy = "fidVfiCaja")
    private List<CuadreCaja> cuadreCajaList;

         //RELACION CON OPE_VENTANILLA

    @JoinColumn(name = "FID_OPE_VENTANILLA", referencedColumnName = "ID_VENTANILLA")
    @ManyToOne(fetch = FetchType.LAZY)
    private Ventanilla fidOpeVentanilla;
 
    

    public Caja() {
    }

    public Caja(Long idCaja) {
        this.idCaja = idCaja;
    }

    public Long getIdCaja() {
        return idCaja;
    }

    public void setIdCaja(Long idCaja) {
        this.idCaja = idCaja;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }



    public List<SaldoCaja> getSaldoCajaList() {
        return saldoCajaList;
    }

    public void setSaldoCajaList(List<SaldoCaja> saldoCajaList) {
        this.saldoCajaList = saldoCajaList;
    }

    public List<DetalleCaja> getDetalleCajaList() {
        return detalleCajaList;
    }

    public void setDetalleCajaList(List<DetalleCaja> detalleCajaList) {
        this.detalleCajaList = detalleCajaList;
    }

    public List<CuadreCaja> getCuadreCajaList() {
        return cuadreCajaList;
    }

    public void setCuadreCajaList(List<CuadreCaja> cuadreCajaList) {
        this.cuadreCajaList = cuadreCajaList;
    }
    

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCaja != null ? idCaja.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Caja)) {
            return false;
        }
        Caja other = (Caja) object;
        if ((this.idCaja == null && other.idCaja != null) || (this.idCaja != null && !this.idCaja.equals(other.idCaja))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vfi.be.Caja[idCaja=" + idCaja + "]";
    }

    /**
     * @return the fidOpeVentanilla
     */
    public Ventanilla getFidOpeVentanilla() {
        return fidOpeVentanilla;
    }

    /**
     * @param fidOpeVentanilla the fidOpeVentanilla to set
     */
    public void setFidOpeVentanilla(Ventanilla fidOpeVentanilla) {
        this.fidOpeVentanilla = fidOpeVentanilla;
    }

    /**
     * @return the cuadreCajaList
     */
    

}
